/*    */ package cn.zzuisa.news.convertor;
/*    */ 
/*    */ import cn.zzuisa.news.DTO.NewsDTO;
/*    */ import cn.zzuisa.news.entity.News;
/*    */ import cn.zzuisa.news.repository.NewsTypeRepository;
/*    */ import cn.zzuisa.news.repository.UserRepository;
/*    */ import cn.zzuisa.news.repository.dao.NewsTypeDAO;
/*    */ import cn.zzuisa.news.repository.dao.UserDAO;
/*    */ import java.util.List;
/*    */ import java.util.stream.Collectors;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class News2NewsDTO
/*    */ {
/* 22 */   private static UserRepository userDAO = new UserDAO();
/* 23 */   private static NewsTypeRepository newsTypeDAO = new NewsTypeDAO();
/*    */ 
/*    */   
/*    */   public static NewsDTO convert(News news) {
/* 27 */     NewsDTO newsDTO = new NewsDTO();
/* 28 */     newsDTO.setuId(news.getuId());
/* 29 */     newsDTO.setCreatetime(news.getCreatetime());
/* 30 */     newsDTO.setNewsAuthor(news.getNewsAuthor());
/* 31 */     newsDTO.setNewsClick(news.getNewsClick());
/* 32 */     newsDTO.setNewsContent(news.getNewsContent());
/* 33 */     newsDTO.setNewsDel(news.getNewsDel());
/* 34 */     newsDTO.setNewsId(news.getNewsId());
/* 35 */     newsDTO.setNewsState(news.getNewsState());
/* 36 */     newsDTO.setNewsType(newsTypeDAO.types(news.getNewsId()));
/* 37 */     newsDTO.setNewsName(news.getNewsName());
/* 38 */     newsDTO.setNewsKeywords(news.getNewsKeywords());
/* 39 */     newsDTO.setPublisher(userDAO.findById(news.getuId()).getNickname());
/* 40 */     return newsDTO;
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/* 49 */   public static List<NewsDTO> convert(List<News> newslist) { return (List)newslist.stream().map(e -> convert(e)).collect(Collectors.toList()); }
/*    */ }


/* Location:              /Users/frank/Desktop/admin/WEB-INF/classes/!/cn/zzuisa/news/convertor/News2NewsDTO.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */